﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using OA.Models;

namespace OA.Controllers
{
    public class LogoController : Controller
    {
        // GET: Logo
        public ActionResult logo()
        {
            var logos = new logo();
            
            logos.Name = "www";
            logos.password = "123";

            var o = new oa();//模型

            o.Logos.Add(logos);//将数据添加到数据库
            o.SaveChanges();//保存到数据库

            

//            var i = o.Logos.First();获取数据

            return View(logos);
        }
        [HttpPost]
        public ActionResult login(string username, string password)
        {
            var os = new oa();
            os.Logos.Where(d => d.Name == username && d.password == password);
            var logos = new logo();
            if (logos.Name == username&&logos.password==password)
            {
                return Json(new
                {
                    Message = "成功"
                });
            }

            return Json(new
            {
                Message = "失败"
            });
        }

    }
}